{% extends "mybase2.html" %}

{% block title %} 我是flash闪现demo{% endblock %}
{% block style %}
    {{ super() }}
    <style>
        .info {
            color: green;
        }

        .warning {
            color: yellow;
        }

      .error {
            color: red;
        }

    </style>
{% endblock %}


{% block content %}

    <h1>有闪现消息后会提示在下面的div中</h1>


    {# 获取闪现消息 #}
    {# 
        with_categories:闪现的分类打开 
        category: 闪现的分类名称，不同的颜色

        只获取指定分类的闪现消息
        messages = get_flashed_messages(categorie_filter=['error'])
    #}
    <div class="container">
        {% with messages = get_flashed_messages(with_categories=True) %}
            {% if messages %}
            <ul class="flashes">
                {% for category,message in messages %}
                <li class="{{ category }}">
                    {{ message }}
                </li>
                {% endfor %}
            </ul>
            {% endif %}
            
        {% endwith %}
    </div>

<form action="{{ url_for('user.user_flash') }}" method="post">
    <p><input type="text" name="username" placeholder="请输入用户名" /></p>
    <p><input type="submit" value="提交"></p>
</form>

{% endblock %}

{% block script %}
    {{ super() }}
    <script>

    </script>
{% endblock %}